﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace JZ.Common.Web
{
    public class RequestParameter
    {
        public RequestParameter(string key, string value)
        {
            Key = key;
            Value = value;
        }

        public string Key { get; set; }
        public string Value { get; set; }

        public static string BuildRequestBody(List<RequestParameter> paramList)
        {
            StringBuilder sb = new StringBuilder();
            foreach (RequestParameter param in paramList)
            {
                sb.Append(string.Format("{0}={1}&", param.Key, param.Value));
            }

            string result = sb.ToString().TrimEnd('&');
            return result;
        }
    }
}
